package com.moli.iov.admin.model.vo.res;

import com.moli.iov.his.dto.RealTimeInfoHbaseDto;
import com.moli.iov.protocol.util.RealTimeInfoUtil;
import com.moli.iov.util.CoordTransformUtil;
import lombok.Data;

import java.util.Date;

/**
 * 车辆轨迹响应类
 */

@Data
public class VehicleGpsVo {

    //车牌号
    private String license;
    //VIN
    private String vin;
//    //车辆位置
//    private VehicleGpsDto vehicleGpsDto;

    private String locationStatus;
    /**
     * 经度
     * 以度为单位乘以 10的6次方,精确到百万分之一
     */
    private double longitude;

    /**
     * 纬度
     * 以度为单位乘以 10的6次方,精确到百万分之一
     */
    private double latitude;

    //车速
    private double speed;
    //方向角
    private int extendGpsDirection;
    //档位
//    private GearStateTag gear;
    private String gear;

    //电源档位
//    private ExtendPowerGearTag extendPowerGear;
    private String powerGear;

    //上报时间
    private Date reportDate;
    //SOC
    private byte soc;

    public VehicleGpsVo(RealTimeInfoHbaseDto realTimeDto){
        if (realTimeDto!=null){
            gear = RealTimeInfoUtil.getGear(realTimeDto.getVehicleAll());
            speed = RealTimeInfoUtil.getSpeed(realTimeDto.getVehicleAll());
            double[] tude=CoordTransformUtil.transformWGS84ToBD09(RealTimeInfoUtil.getLongitude(realTimeDto.getVehicleGps()),RealTimeInfoUtil.getLatitude(realTimeDto.getVehicleGps()));
            latitude = tude[1];
            longitude = tude[0];
            soc = RealTimeInfoUtil.getSoc(realTimeDto.getVehicleAll());
            extendGpsDirection = RealTimeInfoUtil.getGpsDirection(realTimeDto.getExtendVehicleState());
            powerGear = RealTimeInfoUtil.getPowerGear(realTimeDto.getExtendVehicleState());
            reportDate =realTimeDto.getReportDate();
            locationStatus = RealTimeInfoUtil.getLocationStatusK(realTimeDto.getVehicleGps());
        }
    }

}
